package com.ibeeking.found.file.service.common.util;

import com.ibeeking.found.common.constants.GlobalConstant;
import com.ibeeking.found.common.utils.NumberUtils;
import com.ibeeking.nematos.utils.data.StringUtils;

public class NumberUtil {

    public static Long yuan2Cent(String yuan){
        if(StringUtils.isBlank(yuan)){
            return 0L;
        }else{
            yuan=yuan.replaceAll(",","");
            return NumberUtils.yuan2Cent(NumberUtils.string2DecimalNullValue2Zero(yuan));
        }
    }

    public static Integer str2Integer(String stock){
        if(StringUtils.isBlank(stock)){
            return GlobalConstant.ZERO;
        }else{
            stock=stock.replaceAll(",","");
            return NumberUtils.str2Long(stock).intValue();
        }
    }
}
